<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
use Illuminate\Routing\Router;

Route::get('/', function () {
    return redirect(url('wap/login'));
});

Route::post('getCode', 'Business\BaseController@getCode');//验证码
Route::post('checkCode', 'Business\BaseController@checkCode');//check验证码
Route::post('checkInviteCode', 'Business\BaseController@checkInviteCode');//check邀请码

//Route::group(['prefix'=>'wap','middleware'=>['wechat.oauth','check'],'namespace'=>'Business'],function(Router $router){


//Route::group(['prefix'=>'wx','middleware'=>['wechat.oauth','check','register'],'namespace'=>'Business'],function(Router $router) {
/*微信模块*/
//Route::group(['prefix'=>'wx','middleware'=>['check','wechat.oauth'],'namespace'=>'Business'],function(Router $router) {
//
//    /*微信端登录以后：不接受注册登录找回密码*/
////    Route::group(['middleware'=>'checklogin'],function(Router $router) {
//        $router->get('register', 'RegisterController@index');//
//        $router->post('register', 'RegisterController@store');
//        $router->get('login', 'RegisterController@login');
//        $router->post('login', 'RegisterController@loginCheck');//登录验证
//        $router->get('logout', 'RegisterController@logout');//登出
//        $router->get('forgot', 'RegisterController@forgot');
//        $router->post('forgot', 'RegisterController@resetPassword');//重置密码
////    });
//    /*微信端登录以后：不接受注册登录*/
//    Route::group(['middleware'=>'register'],function(Router $router) {
//        /*个人中心*/
//        $router->get('member', 'MemberController@index');//我的
//        $router->post('member/list', 'MemberController@getOrder');//订单数据
//        /*收单*/
//        $router->get('order', 'OrderController@index');
//        $router->post('order', 'OrderController@store');
//    });
//});


/*产品公共模块*/
Route::group(['namespace'=>'Business','middleware'=>['check','register']],function(Router $router){

    $router->any('product','ProductController@index'); //tab列表
    $router->any('product/search','ProductController@search'); //产品搜索
    $router->get('product/show/{id?}',['as'=>'product/show','uses'=>'ProductController@show']); //产品详情
    $router->get('success','OrderController@success'); //成功

});

/*WAP登录模块*/

Route::group(['prefix'=>'wap','namespace'=>'Business','middleware'=>'check'],function(Router $router){

    $router->get('register', 'RegisterController@index');//
    $router->post('register', 'RegisterController@store');
    $router->get('login', 'RegisterController@login');
    $router->post('login', 'RegisterController@loginCheck');//登录验证
    $router->get('logout', 'RegisterController@logout');//登出
    $router->get('forgot', 'RegisterController@forgot');
    $router->post('forgot', 'RegisterController@resetPassword');//重置密码

    /*WAP 个人中心-订单模块*/
    Route::group(['middleware'=>'register'],function(Router $router) {

        /*个人中心*/
        $router->get('member', 'MemberController@index');//我的
        $router->post('member/list','MemberController@getOrder');//订单数据
        /*收单*/
        $router->get('order','OrderController@index');
        $router->post('order','OrderController@store');

    });
});

